package com.mst;

public class aaa {
    public static int aaaa(int[] a) {
        if (a.length == 0) {
            return 0;
        }
        if (a.length == 1) {
            return a[0];
        }
        int[] xiaobenben = new int[a.length];
        xiaobenben[0] = a[0];
        xiaobenben[1] = Math.max(a[0], a[1]);
        for (int i = 2; i < a.length; i++) {
            xiaobenben[i] = Math.max(xiaobenben[i - 2] + a[i], xiaobenben[i - 1]);
        }
        return xiaobenben[a.length - 1];
    }

    public static void main(String[] args) {
        int[] a = {3, 2, 3, 4, 5};
        System.out.println(aaaa(a));
    }
}
